﻿<ResourceDictionary x:Class="SampleModule.MefExport.DataTemplates"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:helpers="clr-namespace:Helpers;assembly=Helpers">

    <Style x:Key="TitleNotification" TargetType="TextBlock">
        <Setter Property="Foreground" Value="{DynamicResource ColorForegroundListItemThemeBrush}" />
        <Setter Property="FontWeight" Value="Normal" />
        <Style.Triggers>
            <DataTrigger Binding="{Binding IsRead}" Value="False">
                <Setter Property="Foreground" Value="{DynamicResource ColorForegroundListItemThemeBrush}" />
                <Setter Property="FontWeight" Value="SemiBold" />
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="PersonneListBoxItem" TargetType="ListBoxItem">
        <Setter Property="Margin" Value="0" />
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBoxItem">
                    <Border x:Name="Border"
                            Margin="0,0,0,0"
                            Background="Transparent"
                            BorderBrush="Transparent"
                            BorderThickness="0"
                            Padding="0"
                            SnapsToDevicePixels="True">
                        <TextBlock VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                   Foreground="{DynamicResource ColorForegroundListItemThemeBrush}"
                                   Padding="0"
                                   Text="{Binding}" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--  DataTemplate Appel  -->
    <DataTemplate x:Key="NotificationUserItemTemplateAppel">
        <Border Style="{StaticResource BorderItemGrid}">

            <!--  Textes  -->
            <Grid Margin="15">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="150" />
                    <ColumnDefinition Width="180" />
                    <ColumnDefinition Width="120" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="30" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>

                <TextBlock Grid.Row="0"
                           Grid.Column="0"
                           FontSize="18"
                           Style="{StaticResource TitleNotification}"
                           Text="{Binding Appel.Sujet}" />
                <TextBlock Grid.Row="1"
                           Grid.Column="0"
                           FontSize="12"
                           Foreground="{DynamicResource ColorForegroundListItemThemeBrush}"
                           Text="{Binding Appel.Message}"
                           TextWrapping="Wrap" />
                <ListBox Grid.Row="0"
                         Grid.RowSpan="2"
                         Grid.Column="1"
                         Margin="20,0,0,5"
                         VerticalAlignment="Bottom"
                         BorderThickness="0"
                         ItemContainerStyle="{StaticResource PersonneListBoxItem}"
                         ItemsSource="{Binding Personnes}"
                         Style="{StaticResource ListBoxTransparent}" />
                <TextBlock Grid.Row="1"
                           Grid.Column="2"
                           Margin="10,0,0,5"
                           HorizontalAlignment="Left"
                           VerticalAlignment="Bottom"
                           FontSize="12"
                           Foreground="{DynamicResource ColorForegroundListItemThemeBrush}"
                           Text="{Binding Appel.SysDateCreation,
                                          StringFormat={}{0:f}}" />
                
                <Button Grid.Column="3" Grid.Row="0" Grid.RowSpan="2" Margin="10,0,0,0" 
                        VerticalAlignment="Center" Content="{helpers:Localize AccueilAppels_SupprimerButton}" Style="{StaticResource ButtonAppBar}"
                        Command="{Binding Path=DataContext.DeleteCommand,
                                              RelativeSource={RelativeSource Mode=FindAncestor,
                                                                             AncestorLevel=1,
                                                                             AncestorType=UserControl}}"
                        CommandParameter="{Binding}" />
            </Grid>
        </Border>
    </DataTemplate>

</ResourceDictionary>

